<?php
require_once("vcl/vcl.inc.php");
//Includes
use_unit("comctrls.inc.php");
use_unit("components4phpfull/jtsitetheme.inc.php");
use_unit("components4phpfull/jtdatepicker.inc.php");
use_unit("buttons.inc.php");
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");

//Class definition
class select_report extends Page
{
       public $btnExcel = null;
       public $btnPrint = null;
       public $Image2 = null;
       public $Image1 = null;
       public $hfDateTo = null;
       public $hfDateFrom = null;
       public $lblVehicle = null;
       public $hfAllOrSelect = null;
       public $hfPrintOrExcel = null;
       public $dateTo = null;
       public $dateFrom = null;
       public $Label7 = null;
       public $JTSiteTheme1 = null;
       public $Label6 = null;
       public $Label5 = null;
       public $Label4 = null;
       public $cmbReportType = null;
       public $Label3 = null;
       public $radioVehicle = null;
       public $Label1 = null;

       function btnExcelJSMouseOut($sender, $params)
       {

       ?>
       //Add your javascript code here
       document.images['btnExcel'].src="image/excel.png";
       <?php

       }

       function btnExcelJSMouseOver($sender, $params)
       {

       ?>
       //Add your javascript code here
       document.images['btnExcel'].src="image/excel2.png";
       <?php

       }

       function btnPrintJSMouseOut($sender, $params)
       {

       ?>
       //Add your javascript code here
       document.images['btnPrint'].src="image/btn_print.png";
       <?php

       }

       function btnPrintJSMouseOver($sender, $params)
       {

       ?>
       //Add your javascript code here
       document.images['btnPrint'].src="image/btn_print2.png";
       <?php

       }

       function radioVehicleJSChange($sender, $params)
       {

       ?>
       var hfAllOrSelect = document.getElementById('hfAllOrSelect');
       if(document.getElementById('radioVehicle_0').checked)
       {
        hfAllOrSelect.value = 'All';
        document.getElementById('lblVehicle').innerHTML = '';
       }
       if(document.getElementById('radioVehicle_1').checked)
       {
        var win_height = 450;
        var win_width = 600;
        var height = window.outerHeight;
        var width = window.outerWidth;
        var top = Math.round((height-win_height)/2);
        var left = Math.round((width-win_width)/2);
        window.open('select_vehicle_report.php','window_select_vehicle','location=no,height='+win_height+',width='+win_width+',top='+top+',left='+left);
       }
       <?php

       }

       function btnExcelJSClick($sender, $params)
       {

       ?>
       document.getElementById('hfDateFrom').value = document.getElementById('f-calendar-field-1').value;
       document.getElementById('hfDateTo').value = document.getElementById('f-calendar-field-2').value;
       document.getElementById('hfPrintOrExcel').value = 'Excel';
       document.select_report.submit();
       <?php

       }

       function btnPrintJSClick($sender, $params)
       {

       ?>
       document.getElementById('hfDateFrom').value = document.getElementById('f-calendar-field-1').value;
       document.getElementById('hfDateTo').value = document.getElementById('f-calendar-field-2').value;
       document.getElementById('hfPrintOrExcel').value = 'Print';
       document.select_report.submit();

       <?php

       }

       function select_reportJSLoad($sender, $params)
       {

       ?>
       document.getElementById('JTDateFrom_dropdown').style.display = "none";
       document.getElementById('JTDateTo_dropdown').style.display = "none";
       <?php

       }

       function select_reportCreate($sender, $params)
       {
        $this->comboTypeItems();

        $this->lblVehicle->Caption = '';

        $this->radioVehicle->setItemIndex(0);
        $this->hfAllOrSelect->setValue('All');
       }

       function comboTypeItems()
       {
        $this->cmbReportType->Clear();
        $this->cmbReportType->AddItem('All',null,'0');
        $this->cmbReportType->AddItem('Work Summary',null,'1');
        $this->cmbReportType->AddItem('Fuel',null,'2');
        $this->cmbReportType->AddItem('Expense',null,'3');
        $this->cmbReportType->AddItem('Incident',null,'4');
        $this->cmbReportType->AddItem('Decommissioned Vehicles',null,'5');
        $this->cmbReportType->AddItem('Insurance',null,'6');
        //$this->cmbReportType->AddItem('Tire',null,'4');

       }
}

global $application;

global $select_report;

//Creates the form
$select_report=new select_report($application);

//Read from resource file
$select_report->loadResource(__FILE__);

//Shows the form
$select_report->show();

?>